package com.yc.springmvc.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping({"/demo","demo1"})
public class DemoController {

    @RequestMapping({"hello","hello1"})
    public String hello(){
        return "hello world";
    }

    @RequestMapping("indexJsp")
    public String indexJsp(){
        return "/WEB-INF/demo/index.jsp";
    }

    @RequestMapping("testHtml")
    public String testHtml(){
        return "redirect:../test.html";
    }

    @ResponseBody
    @RequestMapping("result")
    public Map result(){
        return Map.of("name","张三","age",18);
    }

}
